<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<script type="text/javascript" charset="utf-8" src="${ctx}/editor/kindeditor-min.js"></script>
<div>
	<form id="f_link" action="<c:url value='/admin/link/save.do'/>" method="post" enctype="multipart/form-data">
		<input type="hidden" name="link.linkid" value="${link.linkid}">
		<table id="t_link_detail">
			<tr>
				<th width="75px">类型</th>
				<td>
					<select name="link.types">
						<option value="1">文字</option>
						<option value="2">图片</option>
					</select>
				</td>
			</tr>
			<tr>
			<th width="75px">网站名称</th>
				<td>
					<input type="text" name="link.name" value="${link.name}"/>
				</td>
			</tr>
			<tr>
				<th width="75px">链接地址</th>
				<td>
					<input type="text" name="link.linkUrl" value="${link.linkUrl}"/>
				</td>
			</tr>
			<tr>
			<th width="75px">链接图片</th>
				<td>
					<input type="file" name="image" />
				</td>
			</tr>
			<tr>
			<th width="75px">当前声明图片</th>
				<td>
					<input type="text" name="link.htmlImage" value="${link.htmlImage}" />
					<br/>
					<img alt="xx" src="${ctx}/${link.htmlImage}"/>
				</td>
			</tr>
			<tr>
				<th width="75px">排序</th>
				<td>
					<input type="text" name="link.orders" value="${link.orders}"/>
				</td>
			</tr>
			<tr>
			<th width="75px">是否可用</th>
				<td>
					<input type="checkbox" id="f_link_enabled" name="link.enabled" value="1"/>
					<script type="text/javascript">
						var linkEnabled = "<c:out value='${link.enabled}' />";
						var linkEnabledValue = parseInt(linkEnabled);
						if(linkEnabledValue == 1){
							$("#f_link_enabled").attr("checked",true);
					  	}
					</script>
				</td>
			</tr>
			<tr>
				<th width="75px">描述</th>
				<td>
					<textarea id="link_description" name="link.description" rows="150" cols="80" style="width:600px;height:300px"><c:out value='${link.description}'/></textarea>
				</td>
			</tr>
			<tr>
				<td><input type="submit" name="保存" value="保存"/></td>
			</tr>
		</table>
	</form>
</div>
<script type="text/javascript">
KE.show({
	id : 'link_description',
	imageUploadJson : ctx+'/h/keditor.do',
	fileManagerJson : ctx + '/editor/jsp/file_manager_json.jsp',
	allowFileManager : true,
	afterCreate : function(id) {
		KE.event.ctrl(document, 13, function() {
			KE.util.setData(id);
			document.forms['link_description'].submit();
		});
		KE.event.ctrl(KE.g[id].iframeDoc, 13, function() {
			KE.util.setData(id);
			document.forms['link_description'].submit();
		});
	}
});
</script>